1. Field of the Invention
The present invention generally relates to technologies for processing data on a network interface card (NIC), and specifically to an NIC, a computer device, a method for controlling a read/write operation on a shared memory on a NIC and a method for scheduling a NIC.
2. Description of Related Art
A distributed application refers to an application distributed on different computer nodes and accomplishing a task together through a network. The task can be divided into a plurality of processes, and different processes can be distributed on different computer nodes. The plural processes need to invoke each other frequently, or perform plural read/write operations on the same data. The processes of a distributed application distributed on different nodes usually perform network communications using the TCP/IP protocol. TCP/IP is a general communication protocol for supporting communications of almost all kinds of applications on the transmission layer/network layer. The TCP/IP protocol has not provided customized protocol architecture for distributed applications.
On traditional distributed computer architecture, an independent program buffer for a distributed application is allocated on each computer node. Each process of the distributed program independently performs operations on the program buffer, and performs data transmission through a TCP/IP network. According to the traditional architecture, data is required to go through multi-layered packaging before being transmitted through the network, as well as multi-layered decapsulation after being transmitted through the network. The above encapsulation and decapsulation processes result in delays of multiple times during the entire data transmission process, and cause many unnecessary system overheads.
FIG. 1 illustrates schematic diagram of a system for performing data communication between two computer nodes in the prior art. Specifically, in the example shown in FIG. 1, computer node A requests to read a piece of data from computer node B. The architecture of computer node A includes an application process A, a language runtime A, a network protocol stack A, a device driver module A, a NIC A and a program buffer A, the program buffer usually residing in the physical memory of the computer node. The computer node A can further include other devices not shown in FIG. 1, such as a CPU. The architecture of computer node B is identical with that of computer node A.
In step S1, the application process A transmits a read data request to the language runtime A through a dedicated programming interface; in step S2, the language runtime A converts the read data request into a network data transmission request, and passes it to the network protocol stack A for processing; in step S3, the network protocol stack A, after performing TCP/IP encapsulation on the data, invokes the device driver module A to initiate a direct memory access (DMA) operation of the NIC A; in step S4, the NIC A copies the address of the program buffer A to the NIC memory (not shown) on the NIC A through the DMA operation; in step S5, the NIC A transmits the content in its NIC memory to the NIC B of the other computer node B; in step S6, the NIC B generates an interrupt signal after receiving the data request packet from the NIC A, and informs the device driver module B; in step S7, the device driver module B copies the data request packet from the NIC memory of the NIC B to the program buffer B; in step S8, the device driver module B informs the network protocol stack B of the event of the arrival of the data request packet, and requests the network protocol stack B to parse the arrived data request packet; in step S9, by parsing the data request packet, the network protocol stack B learns that the content in the data request packet is a read data request, and informs the application process B by the language runtime B; in step S10, the application process B reads the data required by the computer node A, and constructs a network response notification, then invokes the language runtime B requesting to transmit the data; in step S11, the language runtime B passes the network response notification to the network protocol stack B to form a network data transmission request; in step S12, after performing TCP/IP protocol encapsulation on the data, the network protocol stack B invokes the device driver module B and indicates the address of the program buffer B in which the data to be transmitted is located to initiate the NIC B to perform a DMA operation; in step S13, the NIC B copies the data from the program buffer B to the NIC memory on the NIC B through the DMA operation; in step S14, the NIC B transmits the data to the NIC A on the computer node A; in step S15, the NIC A forms an interrupt signal after receiving the data from network, and informs the device driver module A; in step S16, the device driver module A copies the data from the NIC memory of the NIC A to the network protocol stack A; in step S17, the device driver module A informs the network protocol stack A of the data arrival event to request the network protocol stack A to parse the arrived data; in step S18, the network protocol stack A learns that the content of the data packet is a response corresponding to the read data request by parsing the data packet, and informs the application process A by the language runtime A, so as to make the application process A get the final result.